<template>
    <div>
        <button @click="isShow = !isShow">显示/隐藏</button>
        <transition name="hello" :appear="true">
            <h1 v-show="isShow">你好啊！</h1>
        </transition>
    </div>
</template>
<script>
import Vue from 'vue';
export default Vue.extend({
    name: 'Test',
    data() {
        return {
            isShow: true,
        }
    },
})
</script>

<style scoped>
/* 动画 */
h1 {
    background-color: orange;
}

.hello-enter-active {
    animation: atguigu 1s;
}

.hello-leave-active {
    animation: atguigu 1s reverse;
}

@keyframes atguigu {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0px);
    }
}
</style>